class ActivityPrase{
    public constructor() {
	}
    private static _instance:ActivityPrase;

    public static instance():ActivityPrase{
		if(!ActivityPrase._instance){
			ActivityPrase._instance = new ActivityPrase();
		}
		return ActivityPrase._instance;
	}

	public requestActivityInfo(call:Function, scope)
	{
		let data = {
            version:GameConst.version
        }
		HttpManager.instance().sendPost(GameConst.httpUrl + 'warriorother/query_welfare', StringUtil.jsonToHttpPostString(data), (e)=>{
            let data = JSON.parse(e)
            if(data && data.data)
			{
				if(call)
                {
                    call.call(scope, data.data);
                }
                let lunchInfo = data.data.lunch;
                let dinnerInfo = data.data.dinner;
                RoleCache.instance().isGetLunchAward = lunchInfo.is_get;
                RoleCache.instance().isGetDinnerAward = dinnerInfo.is_get;
                GameUtil.updateRedPoint(RedPointID.Activity);
			}
        }, this);
	}

    public getWelfare(parma,call?:Function, scope?)
	{
		let data = {
            version:GameConst.version,
            type:parma.type
        }
        UIManager.instance().showNormalLoading();
		HttpManager.instance().sendPost(GameConst.httpUrl + 'warriorother/get_welfare', StringUtil.jsonToHttpPostString(data), (e)=>{
            UIManager.instance().hideNormalLoading();
            let data = JSON.parse(e); 
            if(data.msg == 'ok')
			{
				if(call)
                {
                    call.call(scope, data.data);
                    let award = data.data;
                    GameUtil.openAwardUI(award, null, null);
                }
			}
        }, this);
	}
}